package com.gaogzhen.service;

import com.gaogzhen.domain.Account;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gaogzhen.vo.SymbolAssetVo;
import com.gaogzhen.vo.UserTotalAccountVo;

import java.math.BigDecimal;

/**
* @description ${description}
* @author Administrator
* @date 2022-11-03 11:43
* @version 1.0
*/
public interface AccountService extends IService<Account>{

    /**
     * 资金转入账户
     * @param adminId 审核人
     * @param userId        到账用户id
     * @param coinId        到账币种id
     * @param num           到账数量
     * @param fee           到账手续费
     * @param orderId       订单id
     * @param remark        备注
     * @param businessType  业务类型
     * @param direction     资金流向
     */
    void transferAccountAmount(Long adminId, Long userId, Long coinId, BigDecimal num, BigDecimal fee, Long orderId, String remark, String businessType, Byte direction);

    /**
     * 获取当前用户货币资产
     * @param userId    用户id
     * @param coinCode  币种
     * @return          用户相应货币资产
     */
    Account getUserAccount(Long userId, String coinCode);

    /**
     * 锁定用户资产
     * @param account    账户
     * @param num       金额
     * @param type      业务类型
     * @param orderId   订单id
     * @param fee       手续费
     */
    void lockUserAmount(Account account, BigDecimal num, String type, Long orderId, BigDecimal fee);

    /**
     * 暂时锁定用户的资产
     * @param userId
     *  用户的id
     * @param coinId
     * 币种的id
     * @param mum
     * 锁定的金额
     * @param type
     *      资金流水的类型
     * @param orderId
     *      订单的Id
     * @param fee
     *  本次操作的手续费
     */
    void lockUserAmount(Long userId, Long coinId, BigDecimal mum, String type, Long orderId, BigDecimal fee);

    /**
     * 用户的总资产
     * @param userId    用户的id
     * @return          用户的总资产
     */
    UserTotalAccountVo total(Long userId);

    /**
     * 获取交易对资产
     * @param userId    用户Id
     * @param symbol    交易对
     * @return          交易对资产
     */
    SymbolAssetVo getSymbolAsset(Long userId, String symbol);

    /**
     *
     * @param fromUserId
     * @param toUserId
     * @param coinId
     * @param amount
     * @param businessType
     * @param orderId
     */
    void transferBuyAmount(Long fromUserId, Long toUserId, Long coinId, BigDecimal amount, String businessType, Long orderId);

    /**
     *
     * @param fromUserId
     * @param toUserId
     * @param coinId
     * @param amount
     * @param businessType
     * @param orderId
     */
    void transferSellAmount(Long fromUserId, Long toUserId, Long coinId, BigDecimal amount, String businessType, Long orderId);
}
